import { Component,HostListener,HostBinding, OnInit } from '@angular/core';
import 'rxjs/Rx';
import {Http, Headers} from "@angular/http";
import { Router,
  NavigationExtras } from '@angular/router';
 import { ShowHead } from "../show-head.directive";
import { MessageService } from '../message.service'

 import { ShowBottom } from "../show-bottom.directive";
 import { DataService } from "../data.service";

@Component({
  moduleId: module.id,
  selector: 'app-test',
  templateUrl: 'test.component.html',
  styleUrls: ['test.component.css']
})
export class TestComponent implements OnInit {
msglist:any;
  constructor(public http: Http,public router: Router,public mg:MessageService,public ds:DataService) {
   var mnnn;
    this.msglist = 990;
    
    
   var xx = mg.getmessage() ;



 if(typeof xx.cover === 'function') {
     var yy = ds.getLiveCover(function(data){
    //this.ii = data.data.liveElements;
    console.log('dog in',data);
   console.log("who let the dog out",xx.cover(data.data));


   });

   //var bb = xx.cover(this.ii);

}
 if(typeof xx.format === 'function') {
   var shitt = [];
     var yy = ds.getData(function(data){
    //this.ii = data.data.liveElements;
shitt =xx.format(data.data.liveElements,1011);
mnnn = shitt;
console.log('what going on?',mnnn);
    this.msglist = mnnn;

   }.bind(this));
 
}
     this.msglist = mnnn;
     console.log("right",this.msglist)
}

  ngOnInit() {
  
  }

}
